package vsy.buzzwordbingo.controller;

import java.math.BigInteger;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import vsy.buzzwordbingo.model.GameCore;

@Controller
public class HomeController {
	
	@Resource
	private GameCore gameCore;
	
	@Resource
	private BigInteger minGameSize;

	@Resource
	private BigInteger maxGameSize;
	
	@RequestMapping("/")
	public ModelAndView home(HttpServletRequest request,
			HttpServletResponse response) {
		
		request.setAttribute("minGameSize", minGameSize);
		request.setAttribute("maxGameSize", maxGameSize);
		request.setAttribute("maxGameSizeLength", maxGameSize.toString().length());
		request.setAttribute("games", gameCore.getGames());
		return new ModelAndView("home");
	}

}
